﻿<u:HeaderedToolItem x:Class="WickedFlame.VecDraw.Plugins.Tools"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctrl="clr-namespace:WickedFlame.VecDraw.Base.Controls;assembly=VecDraw.Base"
    xmlns:u="clr-namespace:WickedFlame.Util.Controls;assembly=VecDraw.Util"
    xmlns:core="clr-namespace:WickedFlame.Core;assembly=VecDraw.Core"
    Focusable="False" 
    Title="Tools" Icon="/VecDraw.Resources;component/Images/VecDraw.Icon.Tools.png"  Foreground="WhiteSmoke" FontSize="10" Loaded="ContentDocument_Loaded">

    <Control.Resources>
        
        <Style x:Key="{x:Type ListBoxItem}" TargetType="ListBoxItem">
            <Setter Property="SnapsToDevicePixels" Value="true"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border Name="Border" Padding="2" SnapsToDevicePixels="true">
                            <ContentPresenter />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="Border" Property="Background" Value="#20FFFFFF" />
                            </Trigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="Border" Property="Background" Value="#50FFFFFF"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <Image x:Key="Bucket" Source="/VecDraw.Resources;component/Images/VecDraw.Tool.Bucket.png" Height="16" Width="16" />

        <SolidColorBrush Color="#20FFFFFF" x:Key="SeparatorBrush"/>

    </Control.Resources>

    <ContentControl Foreground="#FFF" FontSize="10">
        <Grid Margin="0,2,0,2">
          
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            

            <ListBox Grid.Row="0" DataContext="{x:Static core:DrawingCanvas.ToolsControler}" ItemsSource="{Binding Tools}" SelectedIndex="{Binding SelectedToolIndex}" Background="Transparent" BorderBrush="Transparent" Foreground="#FFF">
                <ListBox.Resources>
                    <ResourceDictionary>
                        <ResourceDictionary.MergedDictionaries>
                            <ResourceDictionary Source="../Resources/ToolDataTemplates.xaml" />
                        </ResourceDictionary.MergedDictionaries>
                    </ResourceDictionary>
                </ListBox.Resources>
            </ListBox>

            <ctrl:SelectableButton SnapsToDevicePixels="True" Grid.Row="1" x:Name="btnFill" Margin="2,0,2,0" VerticalAlignment="Stretch" Cursor="Hand" Icon="{StaticResource Bucket}" Title="Bucket" Focusable="True" HorizontalAlignment="Stretch" Click="btnFill_Click" IsUnselecteable="False"/>
            
        </Grid>
    </ContentControl>
</u:HeaderedToolItem>
